翻訳と辞書
Words near each other
・ parmacs
・ parmod
・ pars
・ parsec
・ parser
・ parser generator
・ parsing
・ parsley
・ partial differential equation language
・ partial equivalence relation
partial evaluation
・ partial function
・ partial key
・ partial ordering
・ partial response maximum likelihood
・ partially ordered set
・ partition
・ partitioned data set
・ parts
・ parulel


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

partial evaluation : FOLDOC
partial evaluation
(Or "specialisation") An {optimisation} technique where the compiler evaluates some subexpressions at compile time. For example,
pow x 0 = 1
pow x n = if even n
then pxn2 * pxn2
else x * pow x (n-1)
where pxn2 = pow x (n/2)
f x = pow x 5

Since n is known we can specialise pow in its second argument and unfold the recursive calls:
pow5 x = x * x4 where x4 = x2 * x2
x2 = x * x
f x = pow5 x

pow5 is known as the residual. We could now also unfold pow5 giving:
f x = x * x4 where x4 = x2 * x2
x2 = x * x

It is important that the partial evaluation algorithm should terminate. This is not guaranteed in the presence of recursive function definitions. For example, if partial evaluation were applied to the right hand side of the second clause for pow above, it would never terminate because the valu


スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.